package com.sxx.beautifulcity.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.TextView;

import com.sxx.beautifulcity.R;
import com.sxx.beautifulcity.popmenu.CommonPopMenu;


/**
 * Created by dllo on 15/10/29.
 */
public class LineDetailActivity extends DialogBaseActivity implements View.OnClickListener {

    private WebView lineWebView;
    private TextView titleTv, moreTv;
    private ImageView backIv;
    private String id;
    private String path;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview_line);
        init();
    }

    private void init() {
        titleTv = (TextView) findViewById(R.id.titleTv);
        titleTv.setText("精品路线");
        backIv = (ImageView) findViewById(R.id.backIV);
        backIv.setOnClickListener(this);
        moreTv = (TextView) findViewById(R.id.moreTv);
        moreTv.setOnClickListener(this);
        lineWebView = (WebView) findViewById(R.id.lineWebView);
        showDialog();
        Intent intent = getIntent();
        id = intent.getStringExtra("id");
        path = "http://www.365960.com/plus/api/api_show.php?type=show_jd&jp=1&id=" + id;
        lineWebView.loadUrl(path);
        dismissDialog();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.backIV:
                Intent intent = new Intent(this, LineActivity.class);
                startActivity(intent);
                finish();
                overridePendingTransition(R.anim.left_out, R.anim.right_into);
                break;
            case R.id.moreTv:
                PopupMenu menu = CommonPopMenu.setHelpShopPopMenu(v , path);
                break;
        }
    }
}
